<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  <script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>
  <script src="https://cdn.staticfile.org/vue-lazyload/1.3.3/vue-lazyload.js"></script>
  <script src="https://img.bc.haodanku.com/cms/flexible.js"></script>
  <link rel="stylesheet" href="https://at.alicdn.com/t/font_1534407_edyx096nc5c.css">
  <title>淘宝特价版0元购</title>
  <style>
    body {
      -webkit-tap-highlight-color: transparent;
      background-color: #d6191a;
      max-width: 7.5rem;
      width: 100%;
      margin: 0 auto;
    }

    ul,
    li {
      list-style: none;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
    }

    i,
    em {
      font-style: normal;
    }

    a {
      text-decoration: none;
    }

    img {
      border: 0;
      vertical-align: middle;
      display: block;
    }

    [v-cloak] {
      display: none;
    }

    .banenr img {
      width: 100%;
    }

    .strategy {
      width: 4.65rem;
      margin: 0 auto;
    }

    .banner-assembly img {
      width: 7.34rem;
      margin: 0 auto;
    }

    .assemblyApp {
      width: 7.24rem;
      margin: 0 auto;
    }

    .assembly-hc {
      display: flex;
      width: 7.24rem;
      justify-content: space-between;
      margin: 0 auto 10px;
      flex-wrap: wrap;
    }

    .assembly-hc img {
      width: 3.5rem;
      height: 1.91rem;
      flex-shrink: 0; 
    }


    .main {
      min-height: 1rem;
    }

    .fixed-nav {
      z-index: 100;
      width: 7.5rem;
      height: 1.34rem;
      margin: auto;
      box-sizing: border-box;
      padding: .22rem .2rem;
      transform: translateZ(0);
      background: #d71537
    }

    .fixed-nav.fixed {
      position: fixed;
      top: -2px
    }

    .fixed-nav.fixed+.shop-box {
      margin-top: .34rem;
      margin: 1.36rem auto 0;
    }

    .nav {
      background: #fff;
      width: 7.1rem;
      height: 0.9rem;
      margin: 0 auto;
      display: flex;
      border-radius: 0.15rem;
    }



    .nav li {
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1;
      font-size: 0.26rem;
      font-family: PingFang SC;
      font-weight: 500;
      color: #333333;
      position: relative;
      cursor: pointer;
    }

    .nav li::before {
      content: "";
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 1px;
      height: 0.4rem;
      background: #D71537;
      opacity: 0.1;
    }

    .nav li:last-child::before {
      content: initial;
    }

    .nav li.active {
      color: #D71537;
    }

    .nav li.active::after {
      content: '';
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      bottom: 0;
      width: 0.42rem;
      height: 0.06rem;
      background: #D71537;
      color: #D71537;
    }

    .explain-tips {
      width: 4.2rem;
      margin: 0 auto 0.22rem;
    }

    .explain-tips-shop {
      margin: 0 auto 0.02rem;
    }

    .shop-box {
      width: 7.1rem;
      margin: 0.2rem auto 0;

    }

    .shop-box li {
      background-color: #fff;
      padding: 0.15rem 0 0.17rem 0.14rem;
      box-shadow: 0px 0.05rem 0.2rem 0px rgba(0, 0, 0, 0.1);
      border-radius: 0.15rem;
      display: flex;
      overflow: hidden;
      margin-top: 0.2rem;
    }

    .shop-box li:nth-child(1) {
      margin-top: 0;
    }

    .shop-img-box {
      width: 1.8rem;
      height: 1.8rem;
      position: relative;
      border-radius: 0.1rem;
      overflow: hidden;
      flex-shrink: 0;
    }

    .shop-img-box img {
      width: 100%;
      height: 100%;
    }

    .shop-img-box .tips {
      position: absolute;
      left: 0;
      top: 0;
      height: 0.4rem;
      display: flex;
      align-items: center;
      background: rgba(231, 4, 3, 0.7);
      border-radius: 0px 0.15rem 0px 0.1rem;
      font-size: 0.24rem;
      font-family: PingFang SC;
      font-weight: 500;
      color: #FFFFFF;
      padding: 0 0.11rem;
    }

    .shop-info {
      padding-left: 0.29rem;
      width: 74.2%;
      display: flex;
      flex-wrap: wrap;
      /* align-items: center; */
      align-content: space-between;
      padding: 0.12rem 0 0.16rem 0.29rem;
      position: relative;
    }

    .shop-title {
      display: flex;
      align-items: center;
      padding-right: 0.1rem;
      width: 100%;
    }

    .shop-title img {
      width: 0.25rem;
      height: 0.25rem;
      flex-shrink: 0;
    }

    .shop-title p {
      line-height: 1.2;
      margin-left: 0.09rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 0.26rem;
      font-family: PingFang SC;
    }

    .shop-price {
      font-family: PingFang SC;
      font-weight: 500;
      color: #EC1D41;
      font-size: 0;
    }

    .shop-price i {
      font-size: 0.2rem;
    }

    .shop-price em {
      font-weight: bold;
      font-size: 0.38rem;
    }

    .shop-original-price {
      font-size: 0.2rem;
      font-family: PingFang SC;
      text-decoration: line-through;
      color: #666666;
      margin-top: 0.04rem;
    }

    .shop-btn {
      position: absolute;
      right: 0;
      bottom: 0.31rem;
      width: 1.3rem;
      height: 0.55rem;
      background: linear-gradient(-90deg, #FE3A3F 0%, #FAA450 100%);
      box-shadow: 0px 0.05rem 0.1rem 0px rgba(215, 21, 55, 0.2);
      border-radius: 0.28rem 0px 0px 0.28rem;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      ;
      font-size: 0.26rem;
      font-family: PingFang SC;
      font-weight: 800;
      color: #FFFEFD;
      cursor: pointer;
    }

    .goods-card-loading {
      text-align: center;
      padding: .4rem 0;
      color: #fff
    }

    .goods-card-loading span {
      font-size: .24rem;
      color: currentColor;
      letter-spacing: .01rem
    }

    .modals {
      position: fixed;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      z-index: 10000;
      overflow: auto;
      background: rgba(0, 0, 0, .5);
      z-index: 2;
      -webkit-overflow-scrolling: touch;
    }

    .modal {
      position: fixed;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      z-index: 10000;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      /* background: rgba(0, 0, 0, .5); */
    }

    .modal .modal-container {
      margin: 1rem auto;
      width: 6rem;
      background: #fff;
      border-radius: .2rem;
      position: relative;
      z-index: 3;
    }

    .modal .modal-container .title {
      position: relative;
      height: .82rem;
      text-align: center;
      font-size: .26rem;
      font-weight: 700;
      color: #fe3940;
      line-height: .82rem;
      border-bottom: 1px solid #FFF3F5;
    }

    .modal .modal-container .btn-close {
      position: absolute;
      top: 50%;
      right: 0;
      height: .32rem;
      width: .32rem;
      margin-right: .32rem;
      transform: translateY(-50%);
      cursor: pointer;
    }

    .modal .modal-container .btn-close {
      position: absolute;
      top: 50%;
      right: 0;
      height: .32rem;
      width: .32rem;
      margin-right: .32rem;
      transform: translateY(-50%);
      cursor: pointer
    }

    .modal .modal-container .content {
      padding: .3rem
    }

    .modal-app {
      width: 5.36rem;
      margin: 0.26rem 0 0.25rem;
      /* box-shadow: 0px 0.09rem 0.25rem 0px rgba(131, 19, 16, 0.6); */
    }

    .modal-red {
      width: 5.36rem;
    }

    .modal-img-box {
      display: flex;
      justify-content: space-between;
    }

    .modal-img-box img {
      width: 2.7rem;
    }

    .modal-red-one {
      margin-top: 0.36rem;
    }

    .free-loading {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      padding-top: .6rem
    }

    .free-loading>p {
      font-size: .3rem;
      color: #fff;
      letter-spacing: .01rem;
      margin: .2rem 0 0
    }

    .free-loading .la-line-scale {
      width: 1.6rem;
      height: 1.28rem;
      display: block;
      font-size: 0;
      color: #d71537
    }

    .free-loading .la-line-scale>div {
      display: inline-block;
      float: none;
      background-color: currentColor;
      border: 0 solid;
      width: .16rem;
      height: 1.28rem;
      margin: 0 .08rem;
      border-radius: 0;
      -webkit-animation: line-scale 1.2s ease infinite;
      animation: line-scale 1.2s ease infinite;
      background: #fff;
    }

    .free-loading .la-line-scale>div:first-child {
      -webkit-animation-delay: -1.2s;
      animation-delay: -1.2s
    }

    .free-loading .la-line-scale>div:nth-child(2) {
      -webkit-animation-delay: -1.1s;
      animation-delay: -1.1s
    }

    .free-loading .la-line-scale>div:nth-child(3) {
      -webkit-animation-delay: -1s;
      animation-delay: -1s
    }

    .free-loading .la-line-scale>div:nth-child(4) {
      -webkit-animation-delay: -.9s;
      animation-delay: -.9s
    }

    .free-loading .la-line-scale>div:nth-child(5) {
      -webkit-animation-delay: -.8s;
      animation-delay: -.8s
    }
    .modal-assembly-hc{
      width: 100%;
    }
    .modal-assembly-hc img{
      width: 47%;
    height: 1.39rem;
    }
    @-webkit-keyframes line-scale {

      0%,
      40%,
      to {
        transform: scaleY(.4)
      }

      20% {
        transform: scaleY(1)
      }
    }

    @keyframes line-scale {

      0%,
      40%,
      to {
        transform: scaleY(.4)
      }

      20% {
        transform: scaleY(1)
      }
    }
  </style>
</head>

<body>
  <div id="tb_specials" v-cloak>
    <div class="header">
      <div class="banenr">
        <img src="http://img.bc.haodanku.com/haodanku/1616206175">
      </div>
      <div class="header-inenr">
        <img src="http://img.bc.haodanku.com/haodanku/1616206345" class="strategy" v-on:click="showDirect">
        <img :src="assemblyApp[0].img" class="assemblyApp" v-bind:id="'assembly' + assemblyApp[0].oIndex"
          v-on:click="assemblyBtn('#assembly'+ assemblyApp[0].oIndex,assemblyApp[0])">
        <img src="http://img.bc.haodanku.com/haodanku/1616209022" class="explain-tips">
        <div class="banner-assembly">
          <img :src="item.img" v-for="item in assemblyArr" v-bind:id="'assembly' + item.oIndex"
            v-on:click="assemblyBtn('#assembly'+ item.oIndex,item)">
        </div>
        <div class="assembly-hc">
          <img :src="item.img" v-for="item in assemblyHc" v-bind:id="'assembly-hc' + item.id" v-on:click="assemblyHcBtn('#assembly-hc'+ item.id,item)">
        </div>
      </div>
    </div>
    <div class="main">
      <img src="http://img.bc.haodanku.com/haodanku/1616208533" class="explain-tips explain-tips-shop">
      <div class="fixed-nav" ref="nav" v-bind:class="{fixed: navFixed}">
        <ul class="nav">
          <li v-for="nav in navArr" :class={active:nav.id==navId} v-on:click="navBtn(nav)">
            {{nav.title}}
          </li>
        </ul>
      </div>
      <template v-if="listData.list.length || listData.finished">
        <ul class="shop-box" ref="list">
          <li v-for="(item,index) in listData.list" v-bind:item="item" v-bind:key="index">
            <div class="shop-img-box">
              <img v-lazy="item.itempic" v-if="item.itempic">
              <img src="http://img.bc.fqapps.com/fudai13cae4ae6ef16739ed3b100a2ec39e97.gif" v-else>
              <i class="tips">{{navArr[navId].label}}</i>
            </div>
            <div class="shop-info">
              <div class="shop-title">
                <img src="http://img.bc.fqapps.com/id0603302d1b3f6c65c4b86abdae286503.png">
                <p>{{item.itemtitle}}</p>
              </div>
              <div>
                <div class="shop-price">
                  <i>抢购价</i>
                  <em>￥{{parseFloat(item.itemendprice)}}</em>
                </div>
                <p class="shop-original-price">原价：￥{{parseFloat(item.itemprice)}}</p>
              </div>
              <p class="shop-btn" v-on:click="shopBtn('#goods' + index,item)" v-bind:id="'goods' + index">马上抢</p>
            </div>
          </li>
        </ul>
        <div class="goods-card-loading"><span v-if="listData.finished">已经加载到底啦~</span><span v-else>数据正在赶来的路上...</span>
        </div>
      </template>

      <!-- 加载效果 -->
      <div class="free-loading" v-else-if="!listData.list.length && listData.loading">
        <div class="la-line-scale">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
        <p>数据加载中...</p>
      </div>
    </div>
    <div class="modal" v-show="showModal">
      <i class="modals" v-show="showModal" v-on:click="closeDirect"></i>
      <div class="modal-container" v-on:stop="closeDirect">
        <div class="title">玩法攻略<img class="btn-close" v-on:click="closeDirect"
            src="http://img-haodanku-com.cdn.fudaiapp.com/Fvw6D3FiUxMEmst7WvXomZsGL0Gk"></div>
        <div class="content">
          <img style="width: 100%;height: auto;" src="http://img.bc.haodanku.com/haodanku/1616569259">
          <img :src="assemblyApp[0].img" class="modal-app" v-bind:id="'modal-assembly' + assemblyApp[0].oIndex"
            v-on:click="assemblyBtn('#modal-assembly'+ assemblyApp[0].oIndex,assemblyApp[0])">
          <img style="width: 100%;height: auto;" src="http://img.bc.haodanku.com/haodanku/1616569270">
          <img :src="assemblyArr[0].img" class="modal-red modal-red-one"
            v-bind:id="'modal-assembly' + assemblyArr[0].oIndex"
            v-on:click="assemblyBtn('#modal-assembly'+ assemblyArr[0].oIndex,assemblyArr[0])">
          <img :src="assemblyArr[1].img" class="modal-red" v-bind:id="'modal-assembly' + assemblyArr[1].oIndex"
            v-on:click="assemblyBtn('#modal-assembly'+ assemblyArr[1].oIndex,assemblyArr[1])">
            <div class="assembly-hc modal-assembly-hc">
              <img :src="item.img" v-for="item in assemblyHc" v-bind:class="'assembly-hc' + item.id" v-on:click="assemblyHcBtn('.assembly-hc'+ item.id,item)">
            </div>
        </div>
      </div>
    </div>
  </div>
  <script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/layer/2.3/layer.js"></script>
  <script src="https://cdn.staticfile.org/clipboard.js/2.0.4/clipboard.min.js"></script>
  <script>
    var vmUrlSearchs = null;
    function vmRequest(name) {
      if (!vmUrlSearchs) {
        vmUrlSearchs = new vmUrlSearch();
      }
      return vmUrlSearchs[name];
    }

    function vmUrlSearch() {
      var name, value;
      var str = location.href;
      var num = str.indexOf("?");
      str = str.substr(num + 1);
      var arr = str.split("&");
      for (var i = 0; i < arr.length; i++) {
        num = arr[i].indexOf("=");
        if (num > 0) {
          name = arr[i].substring(0, num);
          value = arr[i].substr(num + 1);
          this[name] = value;
        }
      }
    }

    Vue.use(VueLazyload, {
      preLoad: 1.3,
      error: 'http://img.bc.haodanku.com/haodanku/1595237918',
      loading: 'http://img.bc.fqapps.com/fudai13cae4ae6ef16739ed3b100a2ec39e97.gif',
      attempt: 1
    });
    /**
  * 判断是否已滚动到底部
  * @param el {HTMLElement}
  * @param direct {"vertical"|"horizontal"?}
  * @param offset {number?}
  * @returns {boolean}
  */
    function isScrollEnd(el, direct, offset) {
      if (direct === void 0) {
        direct = "vertical";
      }
      if (offset === void 0) {
        offset = 10;
      }
      var scrollTop = el.scrollTop;
      var scrollLeft = el.scrollLeft;
      var scrollHeight = el.scrollHeight;
      var scrollWidth = el.scrollWidth;
      var width = el.clientWidth;
      var height = el.clientHeight;
      if (el === window) {
        scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
        scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
        scrollWidth = document.documentElement.scrollWidth || document.body.scrollWidth;
        width = document.documentElement.clientWidth || document.body.clientWidth;
        height = document.documentElement.clientHeight || document.body.clientHeight;
      }
      if (direct === "vertical") {
        return scrollTop >= scrollHeight - height - offset;
      } else {
        return scrollLeft >= scrollWidth - width - offset;
      }
    }

    /**
 * 判断是否固定在顶部的条件
 * @param target {HTMLElement}
 * @param cb {Function}
 * @return {function(): void}
 */
    function isFixed(target, cb) {
      var container = window;

      function getScrollTop() {
        return document.documentElement.scrollTop || document.body.scrollTop;
      }

      var rect = target.getBoundingClientRect();
      var distanceTop = rect.top + getScrollTop();
      var handler;
      container.addEventListener("scroll", handler = function () {
        // 当滑动距离大于等于分类距离顶部位置时，则固定定位
        cb(getScrollTop() >= distanceTop);
      });
      return function () {
        container.removeEventListener("scroll", handler);
      };
    }

    var bodyScrollTop = 0;
    var htmlScrollTop = 0;

    // 禁止滚动
    function noScroll() {
      var html = document.querySelector("html");
      var body = document.querySelector("body");
      bodyScrollTop = body.scrollTop;
      htmlScrollTop = html.scrollTop;
      html.style.marginTop = -(bodyScrollTop || htmlScrollTop) + "px";
      $(html).addClass("no-scroll");
    }

    // 清除禁止滚动
    function clearNoScroll() {
      var html = document.querySelector("html");
      var body = document.querySelector("body");
      $(html).removeClass("no-scroll");
      html.style.marginTop = "";
      body.scrollTop = bodyScrollTop;
      html.scrollTop = htmlScrollTop;
    }
  </script>
  <script>
    new Vue({
      el: '#tb_specials',
      data: {
        vmCid: vmRequest("cid"),
        vmCode: vmRequest("code"),
        hostLink: window.location.host,
        vmHttp: (function () {
          var protocol = window.location.protocol;
          protocol = protocol.substring(0, protocol.length - 1);
          return protocol.includes("http") ? protocol : "http";
        })(),
        assemblyApp: [{
          img: 'http://img.bc.haodanku.com/haodanku/1616206638',
          oIndex: 0
        }],
        assemblyArr: [
          {
            img: 'http://img.bc.haodanku.com/haodanku/1616206666',
            oIndex: 1
          },
          {
            img: 'http://img.bc.haodanku.com/haodanku/1616223267',
            oIndex: 2
          },

        ],
        assemblyHc: [
          {
            img: 'http://img.bc.haodanku.com/haodanku/1616223215',
            id:'1'
          },
          {
            img: 'http://img.bc.haodanku.com/haodanku/1616223227',
            id:'2'
          },
          {
            img:'http://img.bc.haodanku.com/haodanku/activity/1616770095',
            id:'3'
          },
          {
            img:'	http://img.bc.haodanku.com/haodanku/activity/1616770514',
            id:'4'
          }
        ],
        navArr: [
          {
            title: '限量一元购',
            label: '一元购',
            id: 0
          },
          {
            title: '特价一元购',
            label: '一元购',
            id: 1
          },
          {
            title: '新人福利购',
            label: '福利购',
            id: 2
          }
        ],
        navId: 0,
        showModal: false,
        navFixed: false,
        listData: {
          list: [],
          loading: false,
          finished: false,
          min_id: 1,
          api: ''
        },
        oToken: {
          token: '',
          sig: '',
          api: '',
          msg: '',
          data: {}
        }
      },
      created: function () {
        this.getListData();
      },
      mounted: function () {
        var that = this;
        window.addEventListener("scroll", function (ev) {
          if (isScrollEnd(this, "vertical", 40)) {
            that.getListData();
          }
        });
        setTimeout(function () {
          isFixed(that.$refs.nav, function (fixed) {
            that.navFixed = fixed;
          });
        }, 500);
      },
      methods: {
        scrollToList: function () {
          var top = this.$refs.list.offsetTop;
          var searchBoxHeight = this.$refs.nav.offsetHeight;
          window.scrollTo(0, top - searchBoxHeight);
        },
        navBtn: function (item) {
          this.navId = item.id;
          // this.listData.list = [];
          this.listData.min_id = 1;
          this.listData.loading = false;
          this.listData.finished = false;
          this.scrollToList();
          this.listData.list.forEach(function (item) {
            item.itempic = ''
          });
          this.getListData(true);
        },
        showDirect: function () {
          this.showModal = true;
          noScroll();
        },
        closeDirect: function () {
          this.showModal = false;
          clearNoScroll();
        },
        apiData: function () {
          switch (this.navId) {
            case 0:
              this.listData.api = '://api.haodanku.com/activity/tb_onebuy_items'
              break;
            case 1:
              this.listData.api = '://api.haodanku.com/activity/tb_yifen_items'
              break;
            case 2:
              this.listData.api = '://api.haodanku.com/activity/tb_special_items'
              break;
          }
        },
        /**
        * 获取商品数据
        */
        getListData: function (cb) {
          if (this.listData.loading || this.listData.finished) return;
          var that = this;
          that.listData.loading = true;
          this.apiData();
          $.ajax({
            url: that.vmHttp + that.listData.api,
            type: "GET",
            data: {
              p: this.listData.min_id
            },
            dataType: "json"
          }).done(function (res) {
            if (Number(res.code) !== 200) {
              that.listData.finished = true;
              that.listData.loading = false;
              return;
            }
            setTimeout(function () {
              that.listData.finished = !Boolean(res.data && res.data.length);
              if (cb) {
                that.listData.list = res.data || []
              } else {
                that.listData.list = that.listData.list.concat(res.data || []);
              }
              that.listData.loading = (res.data.length == 0);;
              that.listData.min_id++;

            }, 200);

          }).fail(function () {
            that.listData.finished = true;
            that.listData.loading = false;
          });
        },

        assemblyBtn: function (dom, item) {  //会场
          switch (item.oIndex) {
            case 0:
              this.oToken.api = '://api.haodanku.com/api/special_activity_ratesurl'
              this.oToken.msg = '复制成功，打开手淘领取';
              break;
            case 1:
              this.oToken.api = '://api.haodanku.com/api/activitys_ratesurl'
              this.oToken.msg = '复制成功，打开淘宝特价版领取';
              break;
            case 2:
              this.oToken.api = '://api.haodanku.com/api/creation_taocode'
              this.oToken.msg = '复制成功，打开淘宝特价版领取';
              break;
          }
          this.oToken.data = {
            apikey: 'sylar', //---必填
            tb_name:'tb370655212', //---必填
            pid:'mm_1520060136_2232550319_111181400478',     //---必填
            domain: this.hostLink
          }
          this.handleGoodsTransfer(dom)
        },
        assemblyHcBtn: function (dom, item) {  //会场
          this.oToken.msg = '会场口令复制成功，请打开手淘领取';
          this.oToken.api = '://api.haodanku.com/api/activitys_ratesurl_collection'
          this.oToken.data = {
            apikey: 'sylar', //---必填
            tb_name:'tb370655212', //---必填
            pid:'mm_1520060136_2232550319_111181400478',     //---必填
            type:item.id,
            domain: this.hostLink
          }
          this.handleGoodsTransfer(dom)
        },
        shopBtn: function (dom, item) {  //商品
          this.oToken.msg = '复制成功，打开手淘领取';
          this.oToken.api = '://api.haodanku.com/api/activity_ratesurl';
          switch (this.navId) {
            case 0:
              this.oToken.api = '://api.haodanku.com/api/activity_ratesurl'
              break;
            case 1:
              this.oToken.api = '://v2.api.haodanku.com/ratesurl'
              break;
            case 2:
              this.oToken.api = '://v2.api.haodanku.com/ratesurl'
              break;
          }
          this.oToken.data = {
            apikey: 'sylar', //---必填
            tb_name:'tb370655212', //---必填
            pid:'mm_1520060136_2232550319_111181400478',     //---必填
            get_taoword: 1,
            itemid: item.itemid,
            title: item.itemtitle ? item.itemtitle : undefined,
            domain: this.hostLink
          }
          this.handleGoodsTransfer(dom)
        },
        /**
          * 商品转链
          */
        handleGoodsTransfer: function (dom) {

          var that = this;
          $.ajax({
            url: that.vmHttp + that.oToken.api,
            type: "POST",
            data: that.oToken.data,
            dataType: "json",
            async: false
          }).done(function (res) {
            if (Number(res.code) !== 200 && Number(res.code) !== 1) {
              that.toast(res.msg);
              return;
            }
            if (that.navId != 0) {
              that.oToken.token = '0' + res.data.taoword + '/'
            } else {
              that.oToken.token = res.data;
            }
            that.copyBtn(dom)
          }).fail(function () {
            that.toast("获取淘口令失败");
          });
        },
        /**
          * 复制商品口令
          */
        copyBtn: function (dom) {
          var that = this;

          var clipboard = new ClipboardJS(dom, {
            text: function (target) {
              return that.oToken.token;
            }
          });

          clipboard.on('success', function (e) {
            that.toast(that.oToken.msg)
            e.clearSelection();
            clipboard.destroy();
          });

          clipboard.on('error', function (e) {
            that.toast('复制口令失败！')
          });
        },
        toast: function (msg) {
          layer.msg(msg, {
            shade: 0.4,
            time: 2000,
            shadeClose: true,
          });
        }
      },
    })
  </script>
</body>

</html>